# -*- coding: utf-8 -*-
"""
-------------------------------------------------
File Name： ip_long_transform
Description :
Author : 'li'
date： 2021/2/24
-------------------------------------------------
Change Activity:
2021/2/24:
-------------------------------------------------
"""
from IPy import IP


class IPLongTransform:
    @staticmethod
    def ip_to_long(ip):
        obj = IP(ip)
        return obj.ip

    @staticmethod
    def get_mask(ip):
        obj = IP(ip)
        c = obj.strNetmask()
        c.replace('/', '')
        return int(c)

    @staticmethod
    def long_to_ip(long):
        res = str(IP(long))
        return res


def _main():
    long = IPLongTransform.ip_to_long('fd13:6d20:29dc:cf27:00::/64')
    print(long)
    ip = IPLongTransform.long_to_ip(long)
    print(ip)


if __name__ == '__main__':
    _main()
